

<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../">
<head>
  <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Code linting &mdash; IVRE  documentation</title>
      <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
      <link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=e59714d7" />
      <link rel="stylesheet" type="text/css" href="../_static/graphviz.css?v=4ae1632d" />

  
      <script src="../_static/jquery.js?v=5d32c60e"></script>
      <script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
      <script src="../_static/documentation_options.js?v=5929fcd5"></script>
      <script src="../_static/doctools.js?v=9bcbadda"></script>
      <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../_static/js/theme.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="IVRE: GPL v3" href="../license.html" />
    <link rel="prev" title="Tests" href="tests.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="../index.html" class="icon icon-home">
            IVRE
              <img src="../_static/logo.png" class="logo" alt="Logo"/>
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul>
<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">Overview</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../install/index.html">Installation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../usage/index.html">Usage</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Development</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="web-api.html">Web API</a></li>
<li class="toctree-l2"><a class="reference internal" href="tests.html">Tests</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Code linting</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#running-the-linters">Running the linters</a></li>
<li class="toctree-l3"><a class="reference internal" href="#github-actions">GitHub actions</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Licenses:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../license.html">IVRE: GPL v3</a></li>
<li class="toctree-l1"><a class="reference internal" href="../license-external.html">Licenses for external files</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">IVRE</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="index.html">Development</a></li>
      <li class="breadcrumb-item active">Code linting</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../_sources/dev/linting.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="code-linting">
<h1>Code linting<a class="headerlink" href="#code-linting" title="Link to this heading"></a></h1>
<p>IVRE uses code linters to prevent some easy-to-spot (for a computer)
mistakes and to enforce a consistent code style (or at least, attempt
to do so).</p>
<p>So far, only the Python code uses such linters (<a class="reference external" href="https://flake8.pycqa.org">Flake8</a>, <a class="reference external" href="https://pylint.org/">Pylint</a>, <a class="reference external" href="http://mypy-lang.org/">Mypy</a>, <a class="reference external" href="https://github.com/PyCQA/bandit">Bandit</a>
and <a class="reference external" href="https://github.com/psf/black">Black</a>). Adding similar code
linting capabilities to the Zeek scripts (<cite>zeek/</cite>), LUA
capabilities to the Zeek scripts (<cite>zeek/</cite>), LUA
(<cite>patches/nmap/scripts/</cite>) and JavaScript / HTML (<cite>web/static/</cite>) could
be a good PR idea!</p>
<p>For all the code and the documentation, we also use <a class="reference external" href="https://github.com/codespell-project/codespell">Codespell</a> to prevent typos.</p>
<section id="running-the-linters">
<h2>Running the linters<a class="headerlink" href="#running-the-linters" title="Link to this heading"></a></h2>
<p>To install the Python code linters and Codespell you can simply use
the <code class="docutils literal notranslate"><span class="pre">requirements-linting.txt</span></code> file with Pip, or use any method to
install the latest versions of the <code class="docutils literal notranslate"><span class="pre">black</span></code>, <code class="docutils literal notranslate"><span class="pre">codespell</span></code>,
<code class="docutils literal notranslate"><span class="pre">flake8</span></code> and <code class="docutils literal notranslate"><span class="pre">pylint</span></code> Python modules.</p>
<p>The script <code class="docutils literal notranslate"><span class="pre">pkg/runchecks</span></code> will run all the tests for you with the
expected options and exceptions.</p>
</section>
<section id="github-actions">
<h2>GitHub actions<a class="headerlink" href="#github-actions" title="Link to this heading"></a></h2>
<p>Code linting and spell checking is performed in a dedicated <a class="reference external" href="https://github.com/ivre/ivre/actions/workflows/linting.yml">GitHub
action</a>
(see <a class="reference internal" href="tests.html#github-actions"><span class="std std-ref">GitHub actions</span></a>), with the latest supported
Python version.</p>
</section>
</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="tests.html" class="btn btn-neutral float-left" title="Tests" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../license.html" class="btn btn-neutral float-right" title="IVRE: GPL v3" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2011 - 2025, Pierre LALET.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>